package com.spudtech
{
    
    import flash.geom.*;
    import flash.errors.*;
    import flash.display.*;
    
    import com.spudtech.graphics.*;
    import com.spudtech.collision.*;
    
    
    public class SpudWorld extends SpudGroup
    {
        
        protected var _collisionTree : SpudQuadTree;
        
        
        public function SpudWorld(size : Point,
                                  collision_tree : SpudQuadTree = null)
        {
            super([]);
            
            if (size == null)
            {
                // We weren't given a size
                throw new ArgumentError("SpudWorld constructor must have non-null size");
            }
            else if (size.x <= 0 || size.y <= 0)
            {
                // We were given a non-positive
                // value for either or both
                // dimensions
                throw new ArgumentError("SpudWorld must have positive width and height");
            }
            
            //width = size.x;
            //height = size.y;
            
            _collisionTree = collision_tree;
            
            if (_collisionTree == null)
            {
                // We were not given a
                // quad tree!
                // Use a default tree
                _collisionTree = new SpudQuadTree(size.x,size.y);
                
            }
            
        }
        
        
        override public function begin() : void
        {
            super.begin();
        }
        override public function destroy() : void
        {
            super.destroy();
        }
        
        
        public function getObjectsForCollision(obj : SpudEntity, type : String) : Array
        {
            // Implement in derived classes
            return [];
        }
        
        
        override public function update() : void
        {
            super.update();
        }
        
    }
    
}
